Developer Documentation
PATH  WebObjects 4.5 Documentation > Getting Started With Direct to Java Client

   

Examining the Application

This section illustrates the application's functionality by guiding you through the steps to search for records, modify records, and add new ones.

When the application starts, it opens a window with which you can search for database records. Each of the tabs in the Query Window correspond to an entity in one of the application's models. Not all of the entities in the Movie and Rentals models have tabs in the Query Window. The way Direct to Java Client chooses which entities to represent in the Query Window is described in the section Main, Enumeration, and "Other" Entities.

  1. Focus the Query Window on the Movie entity.

    In the Query Window, click the Movie tab. The Query Window switches its contents to a user interface for searching for Movies.

    Note that the default Direct to Java Client application allows you to search on title and plotSummary. You can easily configure the application to search on different attributes using the Direct to Java Client Assistant (Assistant for short). You will change the search attributes later in this tutorial.

  2. Search for Movies whose titles begin with the letter "A".

    Type "A" in the Title field, and click the Find button. The application lists the Movies meeting the search criteria.

    Note that the application lists title, category, dateReleased, posterName, revenue, trailerName, plotSummary for the Movies in the result set. As with the search attributes, you can easily configure the application to display different attributes in the table, which you will do later.

  3. Search for Movies whose titles begin with the letter "A" or "B".

    Click Clear. Although the "A" is cleared from the Name field, the Movies in the results table remain. To add Movies that start with the letter "B" to the results, type "B" in the Name field, and click Append. Now the results table contains Movies that start with the letter "A" and the letter "B".

    The difference between Find and Append is this: Find replaces the records in the results list with the results of the most recent search. Append adds data from the most recent search to the records already in the results table. So using Append is a way to ORresults together (for example, Movies whose titles start with "A" OR Movies whose titles start with "B").

  4. Open a Movie.

    Select a Movie in the result list and click Open, or simply double-click the Movie's title. Either action opens the Movie in a separate window that displays its attributes and relationships. The attributes--title, category, dateReleased, posterName, revenue, and trailerName--are in the top part of the window. You can edit any of the Movie's attributes here. After making changes, you can save them (click Save at the top of the Movie window) or revert back to the original values (click Revert).

    The Movie's relationships are in the bottom part of the window. One relationship--studios--is displayed by itself in the middle of the window while the others are displayed below in a tab view. The reason for this is explained later in the section Main, Enumeration, and "Other" Entities.

    In the Studio area of the Movie window, you can change the Movie's Studio (Select), open the Movie's Studio (Open), or unassign the Movie's Studio (Deselect). Clicking the Open button simply opens the Movie's Studio in a Studio window which is similar to the Movie window in that it displays Studio attributes and relationships. Clicking Deselect unsets the Movie's studio relationship so that the Movie has no Studio.

  5. Select a new Studio.

    In the Studio area of the Movie window, click Select. A dialog opens for searching for Studios. Type search criteria ("A" in the Name field, for example), and click Find. Choose a Studio from the result list and click OK. The dialog closes, and the Movie's Studio is changed from the original to the one you selected.

    Note that the Movie window now has an asterisk ("*") in the title bar. The asterisk indicates that the Movie has unsaved changes. If you wanted to save the change, you would click Save. In this case, however, click Revert to discard the change.

  6. Examine the relationship tabs at the bottom of the window.

    The relationships for the Plot Summary and Voting tabs--plotSummary and voting--are to-one relationships. Their respective panes allow you to modify the destination objects directly. For example, if you change the contents of the Summary field in the Plot Summary pane and click Save, you change the PlotSummary object's summary value and commit the change to the database.

    The other relationships--directors, reviews, and roles--are to-many relationships. Their panes allow you to add destination objects to the relationships and to delete objects from them. Additionally you can open destination objects (in their own window) and edit them.

  7. Create a new Movie.

    In the Movie window, click New. Alternatively, if the Query Window's Movie tab is still selected, you can click New in the Query Window. Either action creates a new Movie window into which you enter information about the new Movie. Fields with blue titles are required; that is, you can't save the new Movie if the blue titled fields are empty.

    Fill in the Movie's attributes as follows:

    Click Save to save the new Movie.

  8. Set the Movie's Studio to Elite Entertainment.

    In the Studio area of the window, click Select. In the Studio dialog, type "E" in the Name field, and click Find. No results are returned, so you'll have to create the Elite Entertainment Studio.

    Click New in the Studio dialog. The first dialog closes, and a new Studio dialog opens for creating a new Studio. Name the Studio "Elite Entertainment" and provide a budget. Click Save.

    The new Studio is saved to the database and assigned as the Studio for the "Evil Dead 2" Movie.

    You can add directors and movie roles (and their actors) in a similar manner.

Main, Enumeration, and "Other" Entities

Customizing the Application


© 1999 Apple Computer, Inc. – (Draft. Last updated 05 Jan 00)